package com.glsc.ngateway.common.api.platform.dto.it.networkassets;

import cn.hutool.core.annotation.Alias;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.glsc.ngateway.common.api.common.dto.BaseEntityDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.SuperBuilder;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDate;
import java.util.Collections;
import java.util.List;

/**
 * 网络资产维护
 * @author xuchang
 */
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@JsonInclude
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class NetworkAssetMaintenanceDto extends BaseEntityDto implements Serializable {

    private static final long serialVersionUID = 8118729887478204680L;

    @Alias(value = "序列号")
    @ApiModelProperty(value = "序列号")
    private String serialNum;

    @Alias(value = "制造商")
    @ApiModelProperty(value = "制造商")
    private String vendor;

    @Alias(value = "型号")
    @ApiModelProperty(value = "型号")
    private String model;

    @Alias(value = "系统")
    @ApiModelProperty(value = "系统")
    private String os;

    @Alias(value = "版本")
    @ApiModelProperty(value = "版本")
    private String version;

    @Alias(value = "状态")
    @ApiModelProperty(value = "状态")
    private String status;

    @Alias(value = "站点")
    @ApiModelProperty(value = "站点")
    private String site;

    @Alias(value = "主机")
    @ApiModelProperty(value = "机柜")
    private String rack;

    @Alias(value = "单元")
    @ApiModelProperty(value = "单元")
    private String unit;

    @Alias(value = "出厂日期")
    @ApiModelProperty(value = "出厂日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    protected LocalDate manufactureDate;

    @Alias(value = "质保到期")
    @ApiModelProperty(value = "质保到期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    protected LocalDate expiredDate;

    @Alias(value = "资产标签")
    @ApiModelProperty(value = "资产标签")
    private String assetNUM;

    @Alias(value = "合同编号")
    @ApiModelProperty(value = "合同编号")
    private String contractNUM;

//    @JsonIgnore
//    @Alias(value = "最新绑定维保信息")
//    private List<String> maintenanceInfoNumList;

    @Builder.Default
    @ApiModelProperty(value = "最新绑定维保信息")
    private List<MaintenanceInformationDto> maintenanceInfoList = Collections.EMPTY_LIST;

}
